package com.springlearn.springsourcecode.chap3;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author wtcode
 * @Description
 * @date 2025/3/27 - 15:25
 */
@Component
public class LifeCycleBean {

    private static final Logger log = LoggerFactory.getLogger(LifeCycleBean.class);


    public LifeCycleBean(){
        log.debug("构造");
    }


    @Autowired
    public void autowire(@Value("${JAVA_HOME}") String home){
        log.debug("依赖注入:{}",home);
    }


    @PostConstruct
    public void init(){
        log.debug("初始化");
    }

    @PreDestroy
    public void destory(){
        log.debug("销毁");
    }


}
